package com.itheima.controller;

import com.itheima.domain.mongo.*;
import com.itheima.service.mongo.MovementService;
import com.itheima.vo.PageBeanVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/movement")
public class MovementController {

    @Autowired
    private MovementService movementService;

    @PostMapping("/saveMovement")
    public void saveMovement(@RequestBody Movement movement) {
        movementService.saveMovement(movement);
    }

    @GetMapping("/findMyMovement")
    public PageBeanVo findMyMovement(Long userId, Integer pageNum, Integer pageSize) {
        return movementService.findMyMovement(userId, pageNum, pageSize);
    }

    @GetMapping("/findMyFriendMovement")
    public PageBeanVo findMyFriendMovement(Long userId, Integer pageNum, Integer pageSize) {
        return movementService.findMyFriendMovement(userId, pageNum, pageSize);
    }

    @GetMapping("/findRecommendMovement")
    public PageBeanVo findRecommendMovement(Long userId, Integer pageNum, Integer pageSize) {
        return movementService.findRecommendMovement(userId, pageNum, pageSize);
    }

    @GetMapping("/findMovementById")
    public Movement findMovementById(String movementId) {
        return movementService.findMovementById(movementId);
    }

    @GetMapping("/findMovementList")
    public PageBeanVo findMovementList(Long uid, Integer stateInt, Integer pageNum, Integer pageSize) {
        return movementService.findMovementList(uid, stateInt, pageNum, pageSize);
    }

    @PostMapping("/updateMovementState")
    public void updateMovementState(@RequestBody Movement movement) {
        movementService.updateMovementState(movement);
    }
}
